import {
  CanActivate,
  ExecutionContext,
  Inject,
  Injectable,
} from '@nestjs/common';
import { Observable } from 'rxjs';
import { UseAopService } from './use-aop.service';

// 守卫
@Injectable()
export class UseAopGuard implements CanActivate {
  @Inject(UseAopService)
  private useAopService: UseAopService;

  canActivate(
    context: ExecutionContext,
  ): boolean | Promise<boolean> | Observable<boolean> {
    console.log('----UseAopGuard-----');
    console.log('----路由守卫-----', this.useAopService.findAll());
    return true;
  }
}
